gtk/gtkclist.c gtk/gtkctree.c gtk/gtkpixmap.c get rid of using deprecated
authorMichael Natterer <mitch@imendio.com>
Mon, 4 Aug 2008 17:59:43 +0000 (17:59 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Mon, 4 Aug 2008 17:59:43 +0000 (17:59 +0000)
2008-08-04  Michael Natterer  <mitch@imendio.com>

* gtk/gtkclist.c
* gtk/gtkctree.c
* gtk/gtkpixmap.c
* gtk/gtkpreview.c: get rid of using deprecated GDK APIs.

* gtk/gtktext.c: ditto, apart from the text cruft APIs.

svn path=/trunk/; revision=20982

ChangeLog
gtk/gtkclist.c
gtk/gtkctree.c
gtk/gtkpixmap.c
gtk/gtkpreview.c
gtk/gtktext.c

index 08952c52566ea6a199afb406303cd4f1be354be1..b28fe2cbd9ffe402b4dfef4ac4b9e8a302508714 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-08-04  Michael Natterer  <mitch@imendio.com>
+
+       * gtk/gtkclist.c
+       * gtk/gtkctree.c
+       * gtk/gtkpixmap.c
+       * gtk/gtkpreview.c: get rid of using deprecated GDK APIs.
+
+       * gtk/gtktext.c: ditto, apart from the text cruft APIs.
+
 2008-08-04  Michael Natterer  <mitch@imendio.com>
 
        * gdk/gdk.c (gdk_parse_args): call gdk_rgb_set_verbose(TRUE) if
index 35d9eb31a0bc270eae8bff67348e1756017950fa..d4c274cb0e1a43735b04066bda07ec01a37d405c 100644 (file)
@@ -30,7 +30,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_CLIST_C__
 
@@ -2611,14 +2610,14 @@ cell_size_request (GtkCList       *clist,
   switch (clist_row->cell[column].type)
     {
     case GTK_CELL_PIXTEXT:
-      gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap,
-                          &width, &height);
+      gdk_drawable_get_size (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap,
+                             &width, &height);
       requisition->width += width;
       requisition->height = MAX (requisition->height, height);      
       break;
     case GTK_CELL_PIXMAP:
-      gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap,
-                          &width, &height);
+      gdk_drawable_get_size (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap,
+                             &width, &height);
       requisition->width += width;
       requisition->height = MAX (requisition->height, height);
       break;
@@ -3216,8 +3215,8 @@ gtk_clist_set_foreground (GtkCList       *clist,
       clist_row->foreground = *color;
       clist_row->fg_set = TRUE;
       if (GTK_WIDGET_REALIZED (clist))
-       gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (clist)),
-                        &clist_row->foreground);
+       gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)),
+                                  &clist_row->foreground, FALSE, TRUE);
     }
   else
     clist_row->fg_set = FALSE;
@@ -3245,8 +3244,8 @@ gtk_clist_set_background (GtkCList       *clist,
       clist_row->background = *color;
       clist_row->bg_set = TRUE;
       if (GTK_WIDGET_REALIZED (clist))
-       gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (clist)),
-                        &clist_row->background);
+       gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)),
+                                  &clist_row->background, FALSE, TRUE);
     }
   else
     clist_row->bg_set = FALSE;
@@ -4516,8 +4515,8 @@ gtk_clist_realize (GtkWidget *widget)
   gdk_window_set_background (clist->clist_window,
                             &widget->style->base[GTK_STATE_NORMAL]);
   gdk_window_show (clist->clist_window);
-  gdk_window_get_size (clist->clist_window, &clist->clist_window_width,
-                      &clist->clist_window_height);
+  gdk_drawable_get_size (clist->clist_window, &clist->clist_window_width,
+                         &clist->clist_window_height);
 
   /* create resize windows */
   attributes.wclass = GDK_INPUT_ONLY;
@@ -4581,9 +4580,11 @@ gtk_clist_realize (GtkWidget *widget)
 
          colormap = gtk_widget_get_colormap (widget);
          if (clist_row->fg_set)
-           gdk_color_alloc (colormap, &clist_row->foreground);
+           gdk_colormap_alloc_color (colormap, &clist_row->foreground,
+                                      FALSE, TRUE);
          if (clist_row->bg_set)
-           gdk_color_alloc (colormap, &clist_row->background);
+           gdk_colormap_alloc_color (colormap, &clist_row->background,
+                                      FALSE, TRUE);
        }
       
       for (j = 0; j < clist->columns; j++)
@@ -4632,10 +4633,10 @@ gtk_clist_unrealize (GtkWidget *widget)
        }
     }
 
-  gdk_cursor_destroy (clist->cursor_drag);
-  gdk_gc_destroy (clist->xor_gc);
-  gdk_gc_destroy (clist->fg_gc);
-  gdk_gc_destroy (clist->bg_gc);
+  gdk_cursor_unref (clist->cursor_drag);
+  g_object_unref (clist->xor_gc);
+  g_object_unref (clist->fg_gc);
+  g_object_unref (clist->bg_gc);
 
   for (i = 0; i < clist->columns; i++)
     {
@@ -5603,7 +5604,7 @@ draw_cell_pixmap (GdkWindow    *window,
   if (y + height > clip_rectangle->y + clip_rectangle->height)
     height = clip_rectangle->y + clip_rectangle->height - y;
 
-  gdk_draw_pixmap (window, fg_gc, pixmap, xsrc, ysrc, x, y, width, height);
+  gdk_draw_drawable (window, fg_gc, pixmap, xsrc, ysrc, x, y, width, height);
   gdk_gc_set_clip_origin (fg_gc, 0, 0);
   if (mask)
     gdk_gc_set_clip_mask (fg_gc, NULL);
@@ -5788,13 +5789,13 @@ draw_row (GtkCList     *clist,
       switch (clist_row->cell[i].type)
        {
        case GTK_CELL_PIXMAP:
-         gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
-                              &pixmap_width, &height);
+         gdk_drawable_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
+                                 &pixmap_width, &height);
          width += pixmap_width;
          break;
        case GTK_CELL_PIXTEXT:
-         gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
-                              &pixmap_width, &height);
+         gdk_drawable_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
+                                 &pixmap_width, &height);
          width += pixmap_width + GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
          break;
        default:
index f514bc6880f0d06bc79ee6796c33682873e63198..c5e829ada8107d076826eae181e5735518462e52 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include <stdlib.h>
 
-#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_CTREE_C__
 
@@ -676,9 +675,13 @@ ctree_attach_styles (GtkCTree     *ctree,
 
       colormap = gtk_widget_get_colormap (GTK_WIDGET (ctree));
       if (GTK_CTREE_ROW (node)->row.fg_set)
-       gdk_color_alloc (colormap, &(GTK_CTREE_ROW (node)->row.foreground));
+       gdk_colormap_alloc_color (colormap,
+                                  &(GTK_CTREE_ROW (node)->row.foreground),
+                                  FALSE, TRUE);
       if (GTK_CTREE_ROW (node)->row.bg_set)
-       gdk_color_alloc (colormap, &(GTK_CTREE_ROW (node)->row.background));
+       gdk_colormap_alloc_color (colormap,
+                                  &(GTK_CTREE_ROW (node)->row.background),
+                                  FALSE, TRUE);
     }
 
   for (i = 0; i < clist->columns; i++)
@@ -782,7 +785,7 @@ gtk_ctree_unrealize (GtkWidget *widget)
        }
     }
 
-  gdk_gc_destroy (ctree->lines_gc);
+  g_object_unref (ctree->lines_gc);
 }
 
 static gint
@@ -1027,7 +1030,7 @@ draw_cell_pixmap (GdkWindow    *window,
     height = clip_rectangle->y + clip_rectangle->height - y;
 
   if (width > 0 && height > 0)
-    gdk_draw_pixmap (window, fg_gc, pixmap, xsrc, ysrc, x, y, width, height);
+    gdk_draw_drawable (window, fg_gc, pixmap, xsrc, ysrc, x, y, width, height);
 
   if (mask)
     {
@@ -1835,7 +1838,7 @@ draw_row (GtkCList     *clist,
          switch (clist_row->cell[i].type)
            {
            case GTK_CELL_PIXMAP:
-             gdk_window_get_size
+             gdk_drawable_get_size
                (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap, &pixmap_width,
                 &height);
              width += pixmap_width;
@@ -1843,7 +1846,7 @@ draw_row (GtkCList     *clist,
            case GTK_CELL_PIXTEXT:
              if (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap)
                {
-                 gdk_window_get_size 
+                 gdk_drawable_get_size
                    (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
                     &pixmap_width, &height);
                  width += pixmap_width;
@@ -2538,7 +2541,7 @@ real_tree_expand (GtkCTree     *ctree,
   if (GTK_CELL_PIXTEXT 
       (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap)
     {
-      gdk_pixmap_unref
+      g_object_unref
        (GTK_CELL_PIXTEXT
         (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap);
       
@@ -2548,7 +2551,7 @@ real_tree_expand (GtkCTree     *ctree,
       if (GTK_CELL_PIXTEXT 
          (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask)
        {
-         gdk_pixmap_unref
+         g_object_unref
            (GTK_CELL_PIXTEXT 
             (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask);
          GTK_CELL_PIXTEXT 
@@ -2561,12 +2564,12 @@ real_tree_expand (GtkCTree     *ctree,
     {
       GTK_CELL_PIXTEXT 
        (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap = 
-       gdk_pixmap_ref (GTK_CTREE_ROW (node)->pixmap_opened);
+       g_object_ref (GTK_CTREE_ROW (node)->pixmap_opened);
 
       if (GTK_CTREE_ROW (node)->mask_opened) 
        GTK_CELL_PIXTEXT 
          (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask = 
-         gdk_pixmap_ref (GTK_CTREE_ROW (node)->mask_opened);
+         g_object_ref (GTK_CTREE_ROW (node)->mask_opened);
     }
 
 
@@ -2682,7 +2685,7 @@ real_tree_collapse (GtkCTree     *ctree,
   if (GTK_CELL_PIXTEXT 
       (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap)
     {
-      gdk_pixmap_unref
+      g_object_unref
        (GTK_CELL_PIXTEXT
         (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap);
       
@@ -2692,7 +2695,7 @@ real_tree_collapse (GtkCTree     *ctree,
       if (GTK_CELL_PIXTEXT 
          (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask)
        {
-         gdk_pixmap_unref
+         g_object_unref
            (GTK_CELL_PIXTEXT 
             (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask);
          GTK_CELL_PIXTEXT 
@@ -2705,12 +2708,12 @@ real_tree_collapse (GtkCTree     *ctree,
     {
       GTK_CELL_PIXTEXT 
        (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->pixmap = 
-       gdk_pixmap_ref (GTK_CTREE_ROW (node)->pixmap_closed);
+       g_object_ref (GTK_CTREE_ROW (node)->pixmap_closed);
 
       if (GTK_CTREE_ROW (node)->mask_closed) 
        GTK_CELL_PIXTEXT 
          (GTK_CTREE_ROW (node)->row.cell[ctree->tree_column])->mask = 
-         gdk_pixmap_ref (GTK_CTREE_ROW (node)->mask_closed);
+         g_object_ref (GTK_CTREE_ROW (node)->mask_closed);
     }
 
   work = GTK_CTREE_ROW (node)->children;
@@ -2860,9 +2863,9 @@ cell_size_request (GtkCList       *clist,
     case GTK_CELL_PIXTEXT:
       if (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap)
        {
-         gdk_window_get_size (GTK_CELL_PIXTEXT
-                              (clist_row->cell[column])->pixmap,
-                              &width, &height);
+         gdk_drawable_get_size (GTK_CELL_PIXTEXT
+                                 (clist_row->cell[column])->pixmap,
+                                 &width, &height);
          width += GTK_CELL_PIXTEXT (clist_row->cell[column])->spacing;
        }
       else
@@ -2892,8 +2895,8 @@ cell_size_request (GtkCList       *clist,
        }
       break;
     case GTK_CELL_PIXMAP:
-      gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap,
-                          &width, &height);
+      gdk_drawable_get_size (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap,
+                             &width, &height);
       requisition->width += width;
       requisition->height = MAX (requisition->height, height);
       break;
@@ -3029,9 +3032,9 @@ set_cell_contents (GtkCList    *clist,
 
   g_free (old_text);
   if (old_pixmap)
-    gdk_pixmap_unref (old_pixmap);
+    g_object_unref (old_pixmap);
   if (old_mask)
-    gdk_pixmap_unref (old_mask);
+    g_object_unref (old_mask);
 }
 
 static void 
@@ -3048,15 +3051,15 @@ set_node_info (GtkCTree     *ctree,
 {
   if (GTK_CTREE_ROW (node)->pixmap_opened)
     {
-      gdk_pixmap_unref (GTK_CTREE_ROW (node)->pixmap_opened);
+      g_object_unref (GTK_CTREE_ROW (node)->pixmap_opened);
       if (GTK_CTREE_ROW (node)->mask_opened) 
-       gdk_bitmap_unref (GTK_CTREE_ROW (node)->mask_opened);
+       g_object_unref (GTK_CTREE_ROW (node)->mask_opened);
     }
   if (GTK_CTREE_ROW (node)->pixmap_closed)
     {
-      gdk_pixmap_unref (GTK_CTREE_ROW (node)->pixmap_closed);
+      g_object_unref (GTK_CTREE_ROW (node)->pixmap_closed);
       if (GTK_CTREE_ROW (node)->mask_closed) 
-       gdk_bitmap_unref (GTK_CTREE_ROW (node)->mask_closed);
+       g_object_unref (GTK_CTREE_ROW (node)->mask_closed);
     }
 
   GTK_CTREE_ROW (node)->pixmap_opened = NULL;
@@ -3066,15 +3069,15 @@ set_node_info (GtkCTree     *ctree,
 
   if (pixmap_closed)
     {
-      GTK_CTREE_ROW (node)->pixmap_closed = gdk_pixmap_ref (pixmap_closed);
+      GTK_CTREE_ROW (node)->pixmap_closed = g_object_ref (pixmap_closed);
       if (mask_closed) 
-       GTK_CTREE_ROW (node)->mask_closed = gdk_bitmap_ref (mask_closed);
+       GTK_CTREE_ROW (node)->mask_closed = g_object_ref (mask_closed);
     }
   if (pixmap_opened)
     {
-      GTK_CTREE_ROW (node)->pixmap_opened = gdk_pixmap_ref (pixmap_opened);
+      GTK_CTREE_ROW (node)->pixmap_opened = g_object_ref (pixmap_opened);
       if (mask_opened) 
-       GTK_CTREE_ROW (node)->mask_opened = gdk_bitmap_ref (mask_opened);
+       GTK_CTREE_ROW (node)->mask_opened = g_object_ref (mask_opened);
     }
 
   GTK_CTREE_ROW (node)->is_leaf  = is_leaf;
@@ -3256,16 +3259,16 @@ row_delete (GtkCTree    *ctree,
 
   if (ctree_row->pixmap_closed)
     {
-      gdk_pixmap_unref (ctree_row->pixmap_closed);
+      g_object_unref (ctree_row->pixmap_closed);
       if (ctree_row->mask_closed)
-       gdk_bitmap_unref (ctree_row->mask_closed);
+       g_object_unref (ctree_row->mask_closed);
     }
 
   if (ctree_row->pixmap_opened)
     {
-      gdk_pixmap_unref (ctree_row->pixmap_opened);
+      g_object_unref (ctree_row->pixmap_opened);
       if (ctree_row->mask_opened)
-       gdk_bitmap_unref (ctree_row->mask_opened);
+       g_object_unref (ctree_row->mask_opened);
     }
 
   if (ctree_row->row.destroy)
@@ -4610,9 +4613,9 @@ gtk_ctree_node_set_pixmap (GtkCTree     *ctree,
   if (column < 0 || column >= GTK_CLIST (ctree)->columns)
     return;
 
-  gdk_pixmap_ref (pixmap);
+  g_object_ref (pixmap);
   if (mask) 
-    gdk_pixmap_ref (mask);
+    g_object_ref (mask);
 
   clist = GTK_CLIST (ctree);
 
@@ -4645,9 +4648,9 @@ gtk_ctree_node_set_pixtext (GtkCTree     *ctree,
 
   if (pixmap)
     {
-      gdk_pixmap_ref (pixmap);
+      g_object_ref (pixmap);
       if (mask) 
-       gdk_pixmap_ref (mask);
+       g_object_ref (mask);
     }
 
   GTK_CLIST_GET_CLASS (clist)->set_cell_contents
@@ -5094,8 +5097,9 @@ gtk_ctree_node_set_foreground (GtkCTree       *ctree,
       GTK_CTREE_ROW (node)->row.foreground = *color;
       GTK_CTREE_ROW (node)->row.fg_set = TRUE;
       if (GTK_WIDGET_REALIZED (ctree))
-       gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
-                        &GTK_CTREE_ROW (node)->row.foreground);
+       gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
+                                  &GTK_CTREE_ROW (node)->row.foreground,
+                                  FALSE, TRUE);
     }
   else
     GTK_CTREE_ROW (node)->row.fg_set = FALSE;
@@ -5116,8 +5120,9 @@ gtk_ctree_node_set_background (GtkCTree       *ctree,
       GTK_CTREE_ROW (node)->row.background = *color;
       GTK_CTREE_ROW (node)->row.bg_set = TRUE;
       if (GTK_WIDGET_REALIZED (ctree))
-       gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
-                        &GTK_CTREE_ROW (node)->row.background);
+       gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
+                                  &GTK_CTREE_ROW (node)->row.background,
+                                  FALSE, TRUE);
     }
   else
     GTK_CTREE_ROW (node)->row.bg_set = FALSE;
index dc902fd1d3e76fa15683a4cb9f3f422fa36b40f2..74a05aa5a4aee82efc0e0b71d625660b64276707 100644 (file)
@@ -30,7 +30,6 @@
 #include "config.h"
 #include <math.h>
 
-#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_PIXMAP_C__
 
@@ -113,15 +112,15 @@ gtk_pixmap_set (GtkPixmap *pixmap,
       oldwidth = GTK_WIDGET (pixmap)->requisition.width;
       oldheight = GTK_WIDGET (pixmap)->requisition.height;
       if (pixmap->pixmap)
-       gdk_pixmap_unref (pixmap->pixmap);
+       g_object_unref (pixmap->pixmap);
       if (pixmap->pixmap_insensitive)
-       gdk_pixmap_unref (pixmap->pixmap_insensitive);
+       g_object_unref (pixmap->pixmap_insensitive);
       pixmap->pixmap = val;
       pixmap->pixmap_insensitive = NULL;
       if (pixmap->pixmap)
        {
-         gdk_pixmap_ref (pixmap->pixmap);
-         gdk_window_get_size (pixmap->pixmap, &width, &height);
+         g_object_ref (pixmap->pixmap);
+         gdk_drawable_get_size (pixmap->pixmap, &width, &height);
          GTK_WIDGET (pixmap)->requisition.width =
            width + GTK_MISC (pixmap)->xpad * 2;
          GTK_WIDGET (pixmap)->requisition.height =
@@ -145,10 +144,10 @@ gtk_pixmap_set (GtkPixmap *pixmap,
   if (pixmap->mask != mask)
     {
       if (pixmap->mask)
-       gdk_bitmap_unref (pixmap->mask);
+       g_object_unref (pixmap->mask);
       pixmap->mask = mask;
       if (pixmap->mask)
-       gdk_bitmap_ref (pixmap->mask);
+       g_object_ref (pixmap->mask);
     }
 }
 
@@ -203,17 +202,17 @@ gtk_pixmap_expose (GtkWidget      *widget,
         {
          if (!pixmap->pixmap_insensitive)
            build_insensitive_pixmap (pixmap);
-          gdk_draw_pixmap (widget->window,
-                          widget->style->black_gc,
-                          pixmap->pixmap_insensitive,
-                          0, 0, x, y, -1, -1);
+          gdk_draw_drawable (widget->window,
+                             widget->style->black_gc,
+                             pixmap->pixmap_insensitive,
+                             0, 0, x, y, -1, -1);
         }
       else
        {
-          gdk_draw_pixmap (widget->window,
-                          widget->style->black_gc,
-                          pixmap->pixmap,
-                          0, 0, x, y, -1, -1);
+          gdk_draw_drawable (widget->window,
+                             widget->style->black_gc,
+                             pixmap->pixmap,
+                             0, 0, x, y, -1, -1);
        }
 
       if (pixmap->mask)
@@ -247,7 +246,7 @@ build_insensitive_pixmap (GtkPixmap *gtkpixmap)
   GdkPixbuf *pixbuf;
   GdkPixbuf *stated;
   
-  gdk_window_get_size (pixmap, &w, &h);
+  gdk_drawable_get_size (pixmap, &w, &h);
 
   pixbuf = gdk_pixbuf_get_from_drawable (NULL,
                                          pixmap,
@@ -261,7 +260,7 @@ build_insensitive_pixmap (GtkPixmap *gtkpixmap)
   gdk_pixbuf_saturate_and_pixelate (pixbuf, stated,
                                     0.8, TRUE);
 
-  g_object_unref (G_OBJECT (pixbuf));
+  g_object_unref (pixbuf);
   pixbuf = NULL;
   
   insensitive = gdk_pixmap_new (GTK_WIDGET (gtkpixmap)->window, w, h, -1);
@@ -277,7 +276,7 @@ build_insensitive_pixmap (GtkPixmap *gtkpixmap)
 
   gtkpixmap->pixmap_insensitive = insensitive;
 
-  g_object_unref (G_OBJECT (stated));
+  g_object_unref (stated);
 }
 
 #include "gtkaliasdef.c"
index f0f38798e6eb0c0043b244ce88896132ebb9bff0..2cbfba5f35fa6a1d4e797e06484138f5393abf18 100644 (file)
@@ -24,9 +24,6 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#undef GDK_DISABLE_DEPRECATED
-#undef GTK_DISABLE_DEPRECATED
-
 #include "config.h"
 
 #include <math.h>
@@ -35,6 +32,9 @@
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
+
+#undef GTK_DISABLE_DEPRECATED
+
 #include "gtkpreview.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
@@ -95,8 +95,6 @@ gtk_preview_class_init (GtkPreviewClass *klass)
 
   klass->info.gamma = 1.0;
 
-  gdk_rgb_init ();
-
   g_object_class_install_property (gobject_class,
                                    PROP_EXPAND,
                                    g_param_spec_boolean ("expand",
@@ -490,8 +488,8 @@ gtk_preview_expose (GtkWidget      *widget,
   if (GTK_WIDGET_DRAWABLE (widget))
     {
       preview = GTK_PREVIEW (widget);
-      
-      gdk_window_get_size (widget->window, &width, &height);
+
+      gdk_drawable_get_size (widget->window, &width, &height);
 
       gtk_preview_put (GTK_PREVIEW (widget),
                       widget->window, widget->style->black_gc,
index 2c2bfc6be6bdc1118263cf7cfe754bb286bcd8e6..8625ab6da2e9a9258e7e2a9911df4b7420f42648 100644 (file)
@@ -1273,7 +1273,7 @@ gtk_text_realize (GtkWidget *widget)
   text->text_area = gdk_window_new (widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (text->text_area, text);
 
-  gdk_cursor_destroy (attributes.cursor); /* The X server will keep it around as long as necessary */
+  gdk_cursor_unref (attributes.cursor); /* The X server will keep it around as long as necessary */
   
   widget->style = gtk_style_attach (widget->style, widget->window);
   
@@ -1321,7 +1321,7 @@ gtk_text_style_set (GtkWidget *widget,
       
       if (text->bg_gc)
        {
-         gdk_gc_destroy (text->bg_gc);
+         g_object_unref (text->bg_gc);
          text->bg_gc = NULL;
        }
 
@@ -1358,17 +1358,17 @@ gtk_text_unrealize (GtkWidget *widget)
   gdk_window_destroy (text->text_area);
   text->text_area = NULL;
   
-  gdk_gc_destroy (text->gc);
+  g_object_unref (text->gc);
   text->gc = NULL;
 
   if (text->bg_gc)
     {
-      gdk_gc_destroy (text->bg_gc);
+      g_object_unref (text->bg_gc);
       text->bg_gc = NULL;
     }
   
-  gdk_pixmap_unref (text->line_wrap_bitmap);
-  gdk_pixmap_unref (text->line_arrow_bitmap);
+  g_object_unref (text->line_wrap_bitmap);
+  g_object_unref (text->line_arrow_bitmap);
 
   unrealize_properties (text);
 
@@ -1394,7 +1394,7 @@ clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint
     
   if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
     {
-      gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
+      gdk_drawable_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
   
       gdk_gc_set_ts_origin (text->bg_gc,
                            (- text->first_onscreen_hor_pixel + xthick) % width,
@@ -1751,7 +1751,7 @@ gtk_text_motion_notify (GtkWidget      *widget,
       !(mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK)))
     return FALSE;
   
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   
   if ((y < 0) || (y > height))
     {
@@ -2510,21 +2510,21 @@ delete_expose (GtkText* text, guint nchars, guint old_lines, guint old_pixels)
   
   new_pixels = total_line_height (text, new_line, 1);
   
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
   
   if (old_pixels != new_pixels)
     {
       if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
        {
-         gdk_draw_pixmap (text->text_area,
-                          text->gc,
-                          text->text_area,
-                          0,
-                          pixel_height + old_pixels,
-                          0,
-                          pixel_height + new_pixels,
-                          width,
-                          height);
+         gdk_draw_drawable (text->text_area,
+                             text->gc,
+                             text->text_area,
+                             0,
+                             pixel_height + old_pixels,
+                             0,
+                             pixel_height + new_pixels,
+                             width,
+                             height);
        }
       text->vadj->upper += new_pixels;
       text->vadj->upper -= old_pixels;
@@ -2697,21 +2697,21 @@ insert_expose (GtkText* text, guint old_pixels, gint nchars,
   
   new_pixels = total_line_height (text, new_lines, new_line_count);
   
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
   
   if (old_pixels != new_pixels)
     {
       if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
        {
-         gdk_draw_pixmap (text->text_area,
-                          text->gc,
-                          text->text_area,
-                          0,
-                          pixel_height + old_pixels,
-                          0,
-                          pixel_height + new_pixels,
-                          width,
-                          height + (old_pixels - new_pixels) - pixel_height);
+         gdk_draw_drawable (text->text_area,
+                             text->gc,
+                             text->text_area,
+                             0,
+                             pixel_height + old_pixels,
+                             0,
+                             pixel_height + new_pixels,
+                             width,
+                             height + (old_pixels - new_pixels) - pixel_height);
          
        }
       text->vadj->upper += new_pixels;
@@ -3450,7 +3450,7 @@ find_line_containing_point (GtkText* text, guint point,
        scroll_int (text, - LINE_HEIGHT(CACHE_DATA(text->line_start_cache->next)));
     }
 
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   
   for (cache = text->line_start_cache; cache; cache = cache->next)
     {
@@ -4177,7 +4177,7 @@ adjust_adj (GtkText* text, GtkAdjustment* adj)
 {
   gint height;
   
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   
   adj->step_increment = MIN (adj->upper, SCROLL_PIXELS);
   adj->page_increment = MIN (adj->upper, height - KEY_SCROLL_PIXELS);
@@ -4257,7 +4257,7 @@ set_vertical_scroll (GtkText* text)
   text->vadj->upper = data.pixel_height;
   orig_value = (gint) text->vadj->value;
   
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   
   text->vadj->step_increment = MIN (text->vadj->upper, SCROLL_PIXELS);
   text->vadj->page_increment = MIN (text->vadj->upper, height - KEY_SCROLL_PIXELS);
@@ -4322,7 +4322,7 @@ static gint last_visible_line_height (GtkText* text)
   GList *cache = text->line_start_cache;
   gint height;
   
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   
   for (; cache->next; cache = cache->next)
     if (pixel_height_of(text, cache->next) > height)
@@ -4375,17 +4375,17 @@ scroll_down (GtkText* text, gint diff0)
       real_diff += 1;
     }
   
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
   if (height > real_diff)
-    gdk_draw_pixmap (text->text_area,
-                    text->gc,
-                    text->text_area,
-                    0,
-                    real_diff,
-                    0,
-                    0,
-                    width,
-                    height - real_diff);
+    gdk_draw_drawable (text->text_area,
+                       text->gc,
+                       text->text_area,
+                       0,
+                       real_diff,
+                       0,
+                       0,
+                       width,
+                       height - real_diff);
   
   rect.x      = 0;
   rect.y      = MAX (0, height - real_diff);
@@ -4444,17 +4444,17 @@ scroll_up (GtkText* text, gint diff0)
       real_diff += 1;
     }
   
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
   if (height > real_diff)
-    gdk_draw_pixmap (text->text_area,
-                    text->gc,
-                    text->text_area,
-                    0,
-                    0,
-                    0,
-                    real_diff,
-                    width,
-                    height - real_diff);
+    gdk_draw_drawable (text->text_area,
+                       text->gc,
+                       text->text_area,
+                       0,
+                       0,
+                       0,
+                       real_diff,
+                       width,
+                       height - real_diff);
   
   rect.x      = 0;
   rect.y      = 0;
@@ -4471,7 +4471,7 @@ scroll_up (GtkText* text, gint diff0)
       
       text->cursor_pos_y += real_diff;
       cursor_max = drawn_cursor_max(text);
-      gdk_window_get_size (text->text_area, NULL, &height);
+      gdk_drawable_get_size (text->text_area, NULL, &height);
       
       if (cursor_max >= height)
        find_mouse_cursor (text, text->cursor_pos_x,
@@ -4503,7 +4503,7 @@ find_line_params (GtkText* text,
   gint ch_width;
   GdkFont *font;
   
-  gdk_window_get_size (text->text_area, (gint*) &max_display_pixels, NULL);
+  gdk_drawable_get_size (text->text_area, (gint*) &max_display_pixels, NULL);
   max_display_pixels -= LINE_WRAP_ROOM;
   
   lp.wraps             = 0;
@@ -4892,7 +4892,7 @@ draw_line (GtkText* text,
              
          len = 1;
          
-         gdk_window_get_size (text->text_area, &pixels_remaining, NULL);
+         gdk_drawable_get_size (text->text_area, &pixels_remaining, NULL);
          pixels_remaining -= (LINE_WRAP_ROOM + running_offset);
          
          space_width = MARK_CURRENT_TEXT_FONT(text, &mark)->char_widths[' '];
@@ -4939,7 +4939,7 @@ draw_line_wrap (GtkText* text, guint height /* baseline height */)
       bitmap_height = line_arrow_height;
     }
   
-  gdk_window_get_size (text->text_area, &width, NULL);
+  gdk_drawable_get_size (text->text_area, &width, NULL);
   width -= LINE_WRAP_ROOM;
   
   gdk_gc_set_stipple (text->gc,
@@ -5079,7 +5079,7 @@ clear_area (GtkText *text, GdkRectangle *area)
     {
       gint width, height;
       
-      gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
+      gdk_drawable_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
       
       gdk_gc_set_ts_origin (text->bg_gc,
                            (- text->first_onscreen_hor_pixel) % width,
@@ -5101,7 +5101,7 @@ expose_text (GtkText* text, GdkRectangle *area, gboolean cursor)
   gint max_y = MAX (0, area->y + area->height);
   gint height;
   
-  gdk_window_get_size (text->text_area, NULL, &height);
+  gdk_drawable_get_size (text->text_area, NULL, &height);
   max_y = MIN (max_y, height);
   
   TDEBUG (("in expose x=%d y=%d w=%d h=%d\n", area->x, area->y, area->width, area->height));
@@ -5163,7 +5163,7 @@ gtk_text_update_text (GtkOldEditable    *old_editable,
   if (end_pos < start_pos)
     return;
   
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
   area.x = 0;
   area.y = -1;
   area.width = width;
@@ -5219,7 +5219,7 @@ recompute_geometry (GtkText* text)
         GTK_TEXT_INDEX (text, mark.index - 1) != LINE_DELIM)
     decrement_mark (&mark);
 
-  gdk_window_get_size (text->text_area, &width, &height);
+  gdk_drawable_get_size (text->text_area, &width, &height);
 
   /* Fetch an entire line, to make sure that we get all the text
    * we backed over above, in addition to enough text to fill up